﻿using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Windows;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.Integration;

namespace CADTool.WPF_Interface
{
    public class WFP:UserControl
    {
        private static PaletteSet pSet;
        [CommandMethod("MainWPF")]
        public static void M_WPF()
        {
            //pSet 初始化
            if (pSet is null)
            {
                pSet = new PaletteSet("YZQCADTOOL");
                var args=new PsetArgs();
                args.Dic.Add("直线","Line");
                args.Dic.Add("圆","Circle");
                args.Dic.Add("删除","erase");
                foreach (var item in args.Dic)
                {

                }
                //创建WPF
                var wpf=new WPF_Interface.YZQCADTOOL();
                wpf.DataContext= args;
                //新建host
                var host = new ElementHost()
                {
                    AutoSize= true,
                    Dock= DockStyle.Fill,
                    Child =wpf,
                };
                pSet.Add("图层工具",host);
                pSet.Visible= true;
                pSet.Dock = DockSides.Left;
                pSet.Size = new System.Drawing.Size(50, 500);
                return;
            }
            pSet.Visible=!pSet.Visible;
        }

        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // WFP
            // 
            this.Name = "WFP";
            this.Size = new System.Drawing.Size(150, 172);
            this.ResumeLayout(false);

        }
    }
    public class PsetArgs
    {
        public PsetArgs() { }
        public Dictionary<string, string> Dic { get; set; } =new Dictionary<string, string>();
    }

}
